<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <meta name="author" content="Cassie">
  <!-- ie浏览器使用最新的edge引擎渲染页面 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="keywords" content="Notes">
  <title>Cassie_Notesfive_note</title>
  <link rel="shortcut icon" href="../../images/logo.ico"/>
  <!-- link bootstrap -->
  <link rel="stylesheet" href="../../css/bootstrap.min.css"/>
  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"/></script>
  <script src="../../js/bootstrap.min.js"></script> 
  <style>
    body{
    background-color: #f7f3ee!important;
    color: #948c76!important;
    
    /* #e0cc96 */
    }
    a{
    color: #948c76;
    }
    p{
        padding: 4px;
        font-size: 18px;
        border-radius: 4px;
    }
    kbd{
        letter-spacing: 1px;
        font-size: 15px;
    }
    pre{
        font-size: 14px;
        line-height: 1.8;
    }
    pre code{
        padding: 2px 4px!important;
        font-size: 90%!important;
        color: #c7254e!important;
        background-color: #f9f2f4!important;
        border-radius: 4px!important;
    }
    
  </style>
 </head>
 <body>
     <!-- exp：<code> </code>-->
   <div class="container">
<h1>class&&css:获取、修改</h1>
<p class="bg-primary">class&&css:获取、修改</p>
<pre>exp：<code>
<div class="text-primary">HtmlCode:
< ul>
    < li>item1< /li>
    < li class="red">item2< /li>
    < li>item3< /li>
    < li>item4< /li>
    < li>item5< /li>
< /ul></div><span class="text-primary">JavaScriptCode:</span>
var lis = $('ul li')
lis.hover(function(){
<span class="text-muted">// mouseover</span>
<span class="text-muted">// 直接修改值</span>
<span class="text-muted">// 单个 $(this).css('backgroundColor', 'olive') </span>
<span class="text-muted">// 多个</span>
$(this).css({'color':'white', 'backgroundColor':'olive' })
<span class="text-muted">// 使用回调函数通过程序处理属性值，最后返回新的属性值</span>
$(this).css('fontSize', function(index, value) {
    return parseInt(value) * 2
})
<span class="text-muted">// 直接操作class</span>
$(this).addClass('hover')
},function(){ 
<span class="text-muted">// mouseout</span>
<span class="text-muted">// $(this).css('backgroundColor', '')</span>
$(this).css( {'backgroundColor': '', 'color':'black'} )
$(this).css('fontSize', function(index, value) {
    return parseInt(value) / 2
})
$(this).removeClass('hover')
})</code>
</pre>
</div>
  </body>
</html>